package work6;

/**
 * @TODO
 * @Author xu
 * 2025/2/28
 */
public class Emperor {
    private String name;        // 姓名
    private int reignYears;     // 在位时间（年）
    private String achievements; // 政绩
    private String description;  // 描述

    // 构造方法
    public Emperor(String name, int reignYears, String achievements, String description) {
        this.name = name;
        this.reignYears = reignYears;
        this.achievements = achievements;
        this.description = description;
    }

    // Getter 和 Setter 方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getReignYears() {
        return reignYears;
    }

    public void setReignYears(int reignYears) {
        this.reignYears = reignYears;
    }

    public String getAchievements() {
        return achievements;
    }

    public void setAchievements(String achievements) {
        this.achievements = achievements;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    // 显示所有属性的方法
    public void displayInfo() {
        System.out.println("姓名: " + name);
        System.out.println("在位时间: " + reignYears + "年");
        System.out.println("政绩: " + achievements);
        System.out.println("描述: " + description);
    }
}
